package first

/**
  * Created by feng on 19/11/2018.
  */
class Person {

  val id = "9527"
  var age:Int = 18
  private var name:String = "sdt"

  private[this] val pet="xiaoq"

}

class Student(val name:String,val age:Int){
  println("init begin")
  try{
    println("read")
  }catch{
    case e: NullPointerException=>println("print:"+e)
  }finally{
    println("finally")
  }

  private var gender = "male"

  def this(name:String,age:Int,gender:String){
    this(name,age)
    println("execute")
    this.gender = gender
  }

}

class Queen private(val name:String,prop:Array[String],private var age:Int=18){
  println(prop.size)

  def description = name+" is "+age+" years old with "+prop.toBuffer
}

object Queen{
  def main(args: Array[String]): Unit = {

    val queen = new Queen("hatoo",Array("lazhu"),20)
//    println(queen.description())

  }
}